/*
 * TableRowElement.cpp
 *
 *  Created on: 2010-6-7
 *      Author: guobc
 */

#include "TableRowElement.h"
#include "TableHeadElement.h"
#include "TableColumnElement.h"
using namespace HA;

string TableRowElement::mIds[] = { "TR" , ""};
string TableRowElement::mEnds[] = { "TR", "TBODY", "TFOOT", "THEAD", "TABLE" , ""};

TableRowElement::TableRowElement() :
	HA::CommonElement() {

}

ASTNodeList TableRowElement::getTableHeaders() {
	ASTNodeList children = getChildren();
	ASTNode* node;
	TableHeadElement* header;
	ASTNodeList headers;
	int size = children.size();
	for (int i = 0; i < size; i++) {
		node = children.item(i);
		header = dynamic_cast<TableHeadElement*> (node);
		if (header != NULL) {
			headers.append(header);
		}
	}

	return headers;
}

ASTNodeList TableRowElement::getTableColumns() {
	ASTNodeList children = getChildren();
	ASTNode* node;
	TableColumnElement* column;
	ASTNodeList columns;
	int size = children.size();
	for (int i = 0; i < size; i++) {
		node = children.item(i);
		column = dynamic_cast<TableColumnElement*> (node);
		if (column != NULL) {
			columns.append(column);
		}
	}

	return columns;
}

